﻿using J.Model;
using J.ProductGet.Application.Command.ProductSetupCommand;
using MediatR;
using SqlSugar;

namespace J.ProductGet.Application.CommandHandler.ProductSetupCommandHandler
{
    public class ProductSetupGetCommandHandler : IRequestHandler<ProductSetupGetCommand, List<ProductSetup>>
    {
        private readonly ISqlSugarClient _sqlSugarClient;
        public ProductSetupGetCommandHandler(ISqlSugarClient sqlSugarClient)
        {
            _sqlSugarClient = sqlSugarClient;
        }
        public async Task<List<ProductSetup>> Handle(ProductSetupGetCommand request, CancellationToken cancellationToken)
        {
           var list = await _sqlSugarClient.Queryable<ProductSetup>().Where(s=>s.ProductSetupId==request.ProductSetupId).ToListAsync();
            return list;
        }
    }
}
